<!-- partial-home.html -->

<div class="">


    <div class="row" style="margin-top: 10px;margin-left: 50px">

        <div class="col-lg-12 col-md-12 col-sm-12" >
            <div class="col-lg-2 col-md-2 col-sm-2" >
                <button type="button" class="btn btn-blue btn-outlined btn-sm" ng-click="showAddOne=true">
                    <span class="glyphicon glyphicon-plus"></span>添加学生
                </button>

            </div>

            <!-- 过滤条件 -->
            <div class="col-lg-10 col-md-10 col-sm-10" >
                <span class="glyphicon glyphicon-filter" style="margin-right: 10px"></span>
                所属培训班
                <select  style='min-width: 120px;' ng-model="filter.training_id"
                        ng-options="training.id as training.name for training in trainingList"
                         ng-change="pageChangeTo(1)">
                </select>

                所属培训班期
                <select  style='min-width: 150px;' ng-model="filter.traininggrade_id"
                        ng-options="traininggrade.id as traininggrade.name for traininggrade in traininggradeList"
                         ng-change="pageChangeTo(1)">
                </select>

            </div>
        </div>

    </div>


    <!-- 添加区域 -->
    <div class="row"
         style="border: 1px solid #B9D4E4;margin:5px 0;padding: 10px;max-width: 1000px"
         ng-if="showAddOne">
        <br>
        <div class="col-lg-6 col-md-6 col-sm-6">

            <form>

            学生姓名  <input  class="form-control"
                          placeholder=""  ng-model="addEditData.realname">
            登录名  <input  class="form-control"
                          placeholder=""  ng-model="addEditData.username">
            描述<textarea  class="form-control"
                           placeholder=""  ng-model="addEditData.desc"> </textarea>
            </form>

        </div>

        <div class="col-lg-6 col-md-6 col-sm-6">

            入学时间<input  class="form-control" type="date" ng-model="addEditData.startcoursedate"
                       style="line-height: initial" placeholder="yyyy-MM-dd"  />

            所属培训班
            <select class="form-control" style='min-width: 200px;' ng-model="$parent.addEditData.training_id"
                    ng-options="training.id as training.name for training in trainingList">
            </select>

            所属培训班期
            <select class="form-control" style='min-width: 200px;' ng-model="$parent.addEditData.traininggrade_id"
                    ng-options="traininggrade.id as traininggrade.name for traininggrade in traininggradeList">
            </select>

        </div>

        <div class="col-lg-12 col-md-12 col-sm-12" style="margin-top: 20px">
            <button type="button" class="btn btn-green btn-outlined btn-xs" ng-click="addOne()" >
                确定</button>
            <button type="button" class="btn btn-green btn-outlined btn-xs" ng-click="$parent.showAddOne=false" >
                取消</button>
        </div>
    </div>

    <br>



    <div ng-if="theList.length>0" class="row"  >

        <table class="table table-hover table-striped table-bordered table-advanced tablesorter" >
            <thead>
            <tr>

                <th width="10%" style="text-align:center">姓名</th>
                <th width="15%" style="text-align:center">登录名</th>
                <th width="15%" style="text-align:center">描述</th>
                <th width="10%" style="text-align:center">所属班</th>
                <th width="12%" style="text-align:center">所属班期</th>
                <th width="15%" style="text-align:center">入学时间</th>
                <th width="7%" style="text-align:center">毕业？</th>
                <th width="21%" style="text-align:center">操作</th>
            </tr>
            </thead>

            <tbody>

            <tr dir-paginate="one in theList| itemsPerPage: pageSize" total-items="totalNum" current-page="$parent.currentPage">


                <td style="text-align:center">
                    <span ng-if="!one.editing">{{one.realname}}</span>
                    <input ng-if="one.editing" ng-model="addEditData.realname"
                           style="max-width: 90px">
                </td>
                <td style="text-align:center">
                    <span ng-if="!one.editing">{{one.username}}</span>
                    <input ng-if="one.editing" ng-model="addEditData.username"
                           style="max-width: 90px">
                </td>
                <td style="text-align:center">
                    <p ng-if="!one.editing">{{one.desc}}</p>
                    <textarea ng-if="one.editing" ng-model="addEditData.desc" ></textarea>
                </td>

                <!--班信息-->
                <td style="text-align:center">

                    <span ng-if="!one.editing">{{one.trainingname}}</span>

                    <select ng-if="one.editing" style='width: 100px;' ng-model="$parent.addEditData.training_id"
                            ng-options="training.id as training.name  for training in trainingList">
                    </select>

                </td>

                <td style="text-align:center">

                    <span ng-if="!one.editing">{{one.traininggradename}}</span>

                    <select ng-if="one.editing" style='min-width: 200px;' ng-model="$parent.addEditData.traininggrade_id"
                            ng-options="traininggrade.id as traininggrade.name  for traininggrade in traininggradeList">
                    </select>

                </td>

                <td style="text-align:center">
                    <span ng-if="!one.editing">{{one.startcoursedate.toLocaleDateString()}}</span>
                    <input type="date"   ng-if="one.editing" ng-model="$parent.addEditData.startcoursedate"
                           style="line-height: initial"  placeholder="yyyy-MM-dd" >
                </td>

                <td style="text-align:center">
                    <span ng-if="!one.editing && one.graduated">是</span>
                    <span ng-if="!one.editing && !one.graduated">否</span>
                    <select ng-if="one.editing" style='width: 80px;' ng-model="$parent.addEditData.graduated"
                            ng-options="one.v as one.t  for one in [{t:'是',v:true},{t:'否',v:false}]">
                    </select>
                </td>


                <td style="text-align:center">
                    <button type="button" class="btn btn-green btn-outlined btn-xs"
                            ng-click="editOneBegin(one)" ng-if="!one.editing">
                        编辑
                    </button>
                    <button type="button" class="btn btn-green btn-outlined btn-xs"
                                           ng-click="delOne(one)" ng-if="!one.editing">
                        删除
                    </button>
                    <button type="button" class="btn btn-red btn-outlined btn-xs"
                            ng-click="editOneSubmit(one)" ng-if="one.editing">
                        确定</button>
                    <button type="button" class="btn btn-red btn-outlined btn-xs"
                            ng-click="editOneCancel(one)" ng-if="one.editing">
                        取消</button>

                    <button type="button" class="btn btn-green btn-outlined btn-xs"
                            ng-click="showCheckins(one)" ng-if="!one.editing">
                        签到记录
                    </button>
                </td>

            </tr>
            </tbody>

        </table>


        <div class="note note-success" ng-if="theList.length==0" >
            <h4 class="box-heading">没有查询到学生信息</h4>
        </div>

    </div>


    <div ng-if="theList.length>0" class="row" style="text-align: center;font-family: 'Microsoft YaHei';font-size: medium;">
        <dir-pagination-controls boundary-links="true" on-page-change="pageChangeTo(newPageNumber)"></dir-pagination-controls>
    </div>


    <!-- sub view -->
    <div ui-view >
    </div>


</div>

